/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package practica.pkg1.mercurial;

/**
 *
 * @author Administrador
 */
public class  Calculator {
     private int[] info=new int[5];
     private Object[][] information=new Object[5][3];
     private System sys= MainFrame.system;
     
     
     public Object[][] pricesper(){
         int i=0;
         for(Wood w:sys.getListOfWood()){
              information[i][0]=w.getType();
              information[i][1]=info[i];
              information[i][2]=info[i]*w.getPricePerFoot();
            
            i++;
         }
         return information;
     }
    
     public Double Price(){
         double sum=0; 
         int i=0;
         for(Wood w:sys.getListOfWood()){
            if(info[i]!=0){
             sum= sum + info[i]*w.getPricePerFoot(); 
            }
            i++;
         }
         return sum;
     }
     
     public Double ShippingTime(){
         double sum=0;
         int i=0;
         int s;
         for(Wood w:sys.getListOfWood()){
            s=info[i]; 
            if(s>=1 && s<=100){
               sum=sum+ 1*w.getDeliveryTime(); 
            }else if(s>=101 && s<=200){
               sum=sum+ 2*w.getDeliveryTime();
            }else if(s>=201 && s<=300){
               sum=sum+ 3*w.getDeliveryTime();
            }else if(s>=301 && s<=400){
               sum=sum+ 4*w.getDeliveryTime();
            }else if(s>=401 && s<=500){
               sum=sum+ 5*w.getDeliveryTime();
            }   
            i=i+1;
          }
         
           return sum;   
     }

    /**
     * @return the info
     */
    public int[] getInfo() {
        return info;
    }

    /**
     * @param info the info to set
     */
    public void setInfo(int[] info) {
        this.info = info;
    }
}
